<?php
/**
 * LICENSE
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file license.txt or that can be found at 
 * http://code.google.com/p/billboardce/wiki/License.
 *
 * @package    Plugin_Slide_Option_Interface
 * @category   Model
 * @license    http://code.google.com/p/billboardce/wiki/License New BSD License
 * @version    SVN: $Id: $
 */
class Slide_Plugin_Impression extends Bbce_Slide_Plugin_Abstract
{
    /**
     * Title of the plugin, as shown in the interface
     * 
     * @var string
     */    
    protected $_title = 'Impressions';
    
    /**
     * Description of the plugin, as shown in the interface
     * 
     * @var string
     */    
    protected $_description = 'Limits slide impressions.';
    
    /**
     * Generates a Zend_Form object which is displayed when
     * editing the given plugin.  The $values array is
     * a key => value associative array that maps the form
     * field names with their default values, if any.
     * 
     * @param array $values
     * @return object Zend_Form
     */    
    public function getConfigurationForm($values = array())
    {
        $form = new Zend_Form();
        $form->setAttrib('id', 'slideOptionImpressionForm')
             ->setDecorators(array(
                     'FormElements',
                     array('HtmlTag', array('tag' => 'div', 'class' => 'zend_form')),
                     'Form',
             ));
            
        $submit = $form->createElement('submit', 'submitButton', array('label' => 'Submit'));
        $submit->setDecorators(array(
                   array('ViewHelper', array('helper' => 'formSubmit'))
                 ));

        $cancel = $form->createElement('button', 'cancel', array('label' => 'Cancel'));
        $cancel->setAttrib('id', 'cancel');
        $cancel->setDecorators(array(
                   array('ViewHelper', array('helper' => 'formButton'))
                ));
        
        $form->addElements(array());

        $form->setElementDecorators(array(
                  'ViewHelper',
                  'Errors',
                  array('HtmlTag', array('tag' => 'div', 'class' => 'elm')),
                  array('Label', array('tag' => 'span')),
              ))
             ->addElements(array($submit, $cancel));

        $slideId = $form->createElement('hidden', 'slideId');
        $slideId->setValue($values['slideId']);
        $slideId->setDecorators(array(
            array('ViewHelper', array('helper' => 'formHidden'))
        ));

        $form->addElement($slideId);
        
        return $form;        
    }
}